package com.plian.system.service.sys.user.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.plian.Tools.StringUtil;
import com.plian.system.entity.sys.UserOrg;
import com.plian.system.mapper.sys.UserOrgMapper;
import com.plian.system.service.sys.user.IUserOrgService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@AllArgsConstructor
public class UserOrgServiceImpl  extends ServiceImpl<UserOrgMapper, UserOrg> implements IUserOrgService {

    @Override
    public boolean removeByUserId(String userId) {
        if (StringUtil.isBlank(userId)){
            return true;
        }
        return remove(Wrappers.<UserOrg>lambdaQuery().eq(UserOrg::getUserId, userId));
    }

    @Override
    public List<UserOrg> getByUserId(String userId) {
        return list(Wrappers.<UserOrg>lambdaQuery().eq(UserOrg::getUserId, userId));
    }
}
